package com.javatest.springbootcache01.mapper;

import com.javatest.springbootcache01.bean.Employee;
import org.apache.ibatis.annotations.*;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/3/21 21:11
 */

@Mapper
public interface EmployeeMapper {

    @Select("SELECT * FROM employee WHERE id=#{id}")
    Employee getEmpById(Integer id);

    @Update("UPDATE employee SET lastName=#{lastName}, email=#{email} , gender=#{gender} , d_id=#{dId} WHERE id=#{id} ")
    void updateEmp(Employee employee);

    @Delete("DELETE FROM emplyee WHERE id=#{id}")
    void deleteEmp(Integer id);

    @Insert("INSERT INTO emplyee (lastName, email, gender, d_id) VALUES (#{lastName} ,#{email} ,#{gender},#{dId})")
    void insertEmployee(Employee employee);

    @Select("SELECT * FROM employee WHERE lastName=#{lastName} ")
    Employee getEmpByLastName(String lastName);
}
